package com.atguigu.ssyx.search.repository;

import com.atguigu.ssyx.model.search.SkuEs;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

import java.util.List;

/**
 * @作者:胡树苑
 * @时间:2025/9/17 13:50
 */
public interface SkuRepository extends ElasticsearchRepository<SkuEs,Long> {
   //获取爆款商品
    Page<SkuEs> findByOrderByHotScoreDesc(Pageable pageable);

    //判断keyword是否为空 为空根据仓库id+分类id查询
    Page<SkuEs> findByCategoryIdAndWareId(Long categoryId, Long wareId, Pageable pageable);
 //不为空则根据仓库id+分类id+keyword
 Page<SkuEs> findByKeywordAndWareId(String keyword, Long wareId, Pageable pageable);


}
